package com.example.mapper;

import com.example.controller.domain.SearchRequest;
import com.example.entity.Comment;
import com.example.entity.Works;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 操作works相关数据接口
 */
public interface WorksMapper {

    /**
     * 新增
     */
    long insert(Works works);

    /**
     * 删除
     */
    long deleteById(Integer id);

    /**
     * 修改
     */
    long updateById(Works works);

    /**
     * 根据ID查询
     */
    Works selectById(Integer id);

    /**
     * 查询所有
     */
    List<Works> selectAll(Works works);

    List<Works> selectTop10();

    @Update("update works set count = count + 1 where id=#{id}")
    long updateCount(Integer id);

    List<Works> selectCollect(Integer id);

    List<Works> queryForListBySearchKeyword(SearchRequest searchRequest);

    List<Works> queryForMyWorks(Works works);
}